package day16.晚间练习.tcp发送和接收数据;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(10001);
        Socket s = ss.accept();
        InputStream is = s.getInputStream();
        byte[] bytes = new byte[1024];
        int length = is.read(bytes);
        String data = new String(bytes, 0, length);
        System.out.println("数据是:" + data);
        s.close();
        ss.close();


    }
}
